<?php
session_start();

$con=mysql_connect("localhost","root","");
mysql_select_db("linhkienmt",$con);
?>
<html>
<head>
    <title>THẾ GIỚI LINH KIỆN MÁY TÍNH-XUÂN TUẤN</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
<link href="file:///D|/New Folder (2)/css/mau.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.style7 {
	color: #000099;
	font-weight: bold;
}
-->
</style>
</head>
<body>
<?php
$masp=$_GET['masp'];
$con=mysql_connect("localhost","root","");
mysql_select_db("linhkienmt",$con);
if ($masp!="")
{
$sql="select * from sp where masp='$masp'";
$result=mysql_query($sql,$con);
$tongrec= mysql_num_rows($result);
if ($tongrec!=0)
	{
		while ($row=mysql_fetch_array($result))
			{
		$masp=$row[0];
		$tensp=$row[1];
		$maloai=$row[2];
		$mancc=$row[3];
		$dongia=$row[7];
		$dvtinh=$row[5];
		$soluong=$row[6];
		$mota=$row[8];
		$hinhanh=$row[4];
		$hinhanh="<img src='$hinhanh' width='100' height='100'>";
				
				
				
			}
	}
	mysql_close($con);
	}
?>
  <div align="center" class="style17"><center> 
    <span class="style7">SỬA THÔNG TIN MẶT HÀNG</span>
	 </center></div>
<br>
     <form method="post" action="suasp.php">
	  <table align="center" border="1">
		<tr><td> Mã sản phẩm</td>
		<td><input type="text" name="masp" value="<?php echo $masp ?>" readonly="true"></td></tr>
		<tr><td> Tên sản phẩm:</td>
		<td><input type="text" name="tensp" value="<?php echo $tensp ?>"></td></tr>   
		<tr><td>Mã loại sản phẩm:</td>
		<td><input type="text" name="maloai" value="<?php echo $maloai ?>"></td></tr>
		<tr><td>Mã nhà cung cấp:</td>
		<td><input type="text" name="mancc" value="<?php echo $mancc ?>"></td></tr>
		<tr><td> Đơn vị tính:</td>
		<td><input type="text" name="dvtinh" value="<?php echo $dvtinh ?>"></td></tr>
		<tr><td> Số lượng:</td>
		<td><input type="text" name="soluong" value="<?php echo $soluong ?>"></td></tr>
		<tr><td>Đơn giá:</td>
		<td><input type="text" name="dongia" value="<?php echo $dongia ?>"></td></tr>
		<tr><td> Mô tả Sản phẩm:</td>
		<td><input type="text" name="mota" value="<?php echo $mota ?>"></td></tr> 
		<tr><td>
		<input type="submit" name="sua" value="sua">
		</td>
		 </tr>
		</table>
</form>
 
     <?php
if ($_REQUEST['sua']!="")
{
$masp=$_REQUEST[masp]; 
$tensp=$_REQUEST[tensp]; 
$maloai=$_REQUEST[maloai];
$mancc=$_REQUEST[mancc];
$dvtinh=$_REQUEST[dvtinh]; 
$soluong=$_REQUEST[soluong]; 
$dongia=$_REQUEST[dongia];
$mota=$_REQUEST[mota];
$con=mysql_connect("localhost","root","");
mysql_select_db("linhkienmt",$con);
$sql= "update sp set tensp='$tensp',maloai='$maloai',mancc='$mancc',dvtinh='$dvtinh',soluong='$soluong',dongia='$dongia',mota='$mota' where masp='$masp'";
$result=mysql_query($sql,$con);		
echo"Đã sửa thành công 1 bản ghi";
mysql_close($con);
}
?>
</body>
<!-- Mirrored from www.suaonline.com.vn/?HOME/VN/ by HTTrack Website Copier/3.x [XR&CO'2010], Tue, 21 Dec 2010 13:15:47 GMT -->
</html>
